package com.lapian.designmode.observer.improve.test.improveF;


import java.util.ArrayList;
import java.util.List;

/**
 * 创建日期：2022/5/31 0031 16:25
 *
 * @author tony.sun
 * 类说明：
 */
public class WeatherDateF implements SubjectF {
    List<ObserverF> list=new ArrayList<>();
    private String type;

    @Override
    public void registerObserver(ObserverF observerF) {
        list.add(observerF);
    }

    @Override
    public void unRegisterObserver(ObserverF observerF) {

    }

    @Override
    public void notifyObservers() {
        for (int i = 0; i < list.size(); i++) {
            list.get(i).user(type);
        }
    }

    public void setDate(String type) {
        this.type=type;
        notifyObservers();
    }
}
